<template>
  <div class="exReviewContent">
    <div class="exReviewTitle">
      <!-- <div class="customerTitle">海川医药外复核{{ systemTime }}日报</div> -->
      <div class="customerTitle">海川医药外复核{{ dateTransfer }}日报</div>
      <!-- <div class="searchBtn">
        <el-date-picker
          v-model="dateRange"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="date"
        ></el-date-picker>
        <el-button type="success" @click="handleExreviewSearch">搜索</el-button>
      </div> -->
    </div>
    <div class="exreviewtable">
      <div class="customtr1">
        <div class="customText">客户/类别</div>
        <div class="customText">出库单据数</div>
        <div class="customText">出库条目数</div>
        <div class="customText">出库件数</div>
        <div class="customText">异常单据(次日跟进结果)</div>
        <div class="completeText">作业结束时间</div>
      </div>
      <div class="customtr2">
        <div class="customText wyLayout">陕西海通</div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculateckdjsTotal"
              v-model="form.htCkdjs"
              size="medium"
            />
          </div>
        </div>
        <div class="customText">
          <el-input
            @input="calculatecktmsTotal"
            v-model="form.htCktms"
            size="medium"
          />
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              v-model="form.htCkjs"
              @input="calculateckjsTotal"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculateycdjTotal"
              v-model="form.htYcdj"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop noborder">
            <el-time-picker
              v-model="form.htZyjssj"
              placeholder=""
              value-format="HH:mm"
              format="HH:mm"
            >
            </el-time-picker>
          </div>
        </div>
      </div>
      <div class="customtr2">
        <div class="customText wyLayout">陕西伟业</div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculateckdjsTotal"
              v-model="form.wyCkdjs"
              size="medium"
            />
          </div>
        </div>
        <div class="customText">
          <el-input
            @input="calculatecktmsTotal"
            v-model="form.wyCktms"
            size="medium"
          />
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              v-model="form.wyCkjs"
              @input="calculateckjsTotal"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculateycdjTotal"
              v-model="form.wyYcdj"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop noborder">
            <el-time-picker
              v-model="form.wyZyjssj"
              placeholder=""
              value-format="HH:mm"
              format="HH:mm"
            >
            </el-time-picker>
          </div>
        </div>
      </div>
      <div class="customtr3">
        <div class="customText wyLayout">其他货主</div>
        <div class="customText">
          <el-input
            @input="calculateckdjsTotal"
            v-model="form.qtCkdjs"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            @input="calculatecktmsTotal"
            v-model="form.qtCktms"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            v-model="form.qtCkjs"
            @input="calculateckjsTotal"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            @input="calculateycdjTotal"
            v-model="form.qtYcdj"
            size="medium"
          />
        </div>
        <div class="completeText">
          <el-time-picker
            v-model="form.qtZyjssj"
            placeholder=""
            value-format="HH:mm"
            format="HH:mm"
          >
          </el-time-picker>
        </div>
      </div>
      <div class="customtr4">
        <div class="customText wyLayout">合计</div>
        <div class="customText">
          <el-input disabled v-model="ckdjsTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="cktmsTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="ckjsTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="ycdjTotal" size="medium" />
        </div>
        <div class="completeText"></div>
      </div>
    </div>
  </div>
</template>

<script>
import { dailyscreenexreview } from "@/api/system/daily";
export default {
  props:{
     dateTransfer:{
      type:String,
     }
  },
  data() {
    return {
      dateRange: new Date().toISOString().split("T")[0],
      // 陕西海通零货条目数
      ids: null,
      systemTime: "",
      ckdjsTotal: undefined,
      cktmsTotal: undefined,
      ckjsTotal: undefined,
      ycdjTotal: undefined,
      // 伟业
      form: {
        rbSj: new Date().toISOString().split("T")[0],
        // 海通
        htCkdjs: null,
        htCktms: null,
        htCkjs: null,
        htYcdj: null,
        htZyjssj: null,
        // 伟业
        wyCkdjs: null,
        wyCktms: null,
        wyCkjs: null,
        wyYcdj: null,
        wyZyjssj: null,
        // 其他
        qtCkdjs: null,
        qtCktms: null,
        qtCkjs: null,
        qtYcdj: null,
        qtZyjssj: null,
      },
    };
  },
  mounted() {
    // 创建一个 Date 对象
    const currentDate = new Date();
    // 获取当前年份
    const year = currentDate.getFullYear();
    // 获取当前月份（注意：月份是从 0 开始计数的，所以需要加 1）
    const month = currentDate.getMonth() + 1;
    // 获取当前日期
    const day = currentDate.getDate();
    // 打印年月日
    this.systemTime = `${year}年${month}月${day}日`;
  },
  beforeDestroy() {},
  methods: {
    handleExreviewSearch() {
      dailyscreenexreview({ rbSj: this.dateTransfer }).then((res) => {
        if (res.data) {
          this.form = res.data;
          this.ckdjsTotal =
            Number(this.form.htCkdjs) +
            Number(this.form.wyCkdjs) +
            Number(this.form.qtCkdjs);
          this.cktmsTotal =
            Number(this.form.htCktms) +
            Number(this.form.wyCktms) +
            Number(this.form.qtCktms);
          this.ckjsTotal =
            Number(this.form.htCkjs) +
            Number(this.form.wyCkjs) +
            Number(this.form.qtCkjs);
          this.ycdjTotal =
            Number(this.form.htYcdj) +
            Number(this.form.wyYcdj) +
            Number(this.form.qtYcdj);
        }
      });
    },
    calculateckdjsTotal() {
      this.ckdjsTotal =
        Number(this.form.htCkdjs) +
        Number(this.form.wyCkdjs) +
        Number(this.form.qtCkdjs);
    },
    calculatecktmsTotal() {
      this.cktmsTotal =
        Number(this.form.htCktms) +
        Number(this.form.wyCktms) +
        Number(this.form.qtCktms);
    },
    calculateckjsTotal() {
      this.ckjsTotal =
        Number(this.form.htCkjs) +
        Number(this.form.wyCkjs) +
        Number(this.form.qtCkjs);
    },
    calculateycdjTotal() {
      this.ycdjTotal =
        Number(this.form.htYcdj) +
        Number(this.form.wyYcdj) +
        Number(this.form.qtYcdj);
    },
  },
};
</script>

<style lang="scss" scoped>
.exReviewContent {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  ::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td {
    background-color: transparent;
  }
  ::v-deep .el-date-editor.el-input,
  .el-date-editor.el-input__inner {
    width: 100%;
  }

  .exReviewTitle {
    width: 100%;
    text-align: center;
    .customerTitle {
      width: 100%;
      font-size: 30px;
      font-weight: 700;
      margin: 30px 0 20px 0;
    }
    ::v-deep .el-button--success {
      height: 36px;
      margin-left: 30px;
    }
  }
  .exreviewtable {
    width: 80%;
    margin-top: 20px;
    ::v-deep .el-input__inner {
      height: 65px;
      line-height: 65px;
      border: none;
      text-align: center;
      color: #000000;
      width: 100%;
    }
  }
  .customtr1 {
    width: 100%;
    height: 70px;
    border: 1px solid #e7dfdf;
    background: #05a5ff;
    display: flex;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    justify-content: space-around;
    .customText {
      width: 16.6%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-right: 1px solid #e7dfdf;
    }
    .completeText {
      width: 16.6%;
      height: 70px;
      line-height: 70px;
      text-align: center;
    }
  }
  .customtr2 {
    width: 100%;
    height: 70px;
    border-bottom: 1px solid #181616;
    border-left: 1px solid #181616;
    border-right: 1px solid #181616;
    // background: #00d9ff;
    display: flex;
    justify-content: space-around;
    .customText {
      width: 16.6%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-right: 1px solid #181616;
    }
    .wyLayout {
      font-weight: 700;
    }
    .delivery {
      width: 16.6%;
      display: flex;
      flex-direction: column;
      //   border-right: 1px solid #181616;
      .deliveryTop {
        height: 100%;
        line-height: 70px;
        border-right: 1px solid #181616;
      }
      .noborder {
        border-right: none !important;
      }
    }
  }
  .customtr3 {
    width: 100%;
    height: 70px;
    border-bottom: 1px solid #181616;
    border-left: 1px solid #181616;
    border-right: 1px solid #181616;
    // background: #00d9ff;
    display: flex;
    justify-content: space-around;
    .customText {
      width: 16.6%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-right: 1px solid #181616;
    }
    .wyLayout {
      font-weight: 700;
    }
    .completeText {
      width: 16.6%;
      height: 70px;
      line-height: 70px;
      // text-align: center;
    }
  }
  .customtr4 {
    width: 100%;
    height: 70px;
    border-bottom: 1px solid #181616;
    border-left: 1px solid #181616;
    border-right: 1px solid #181616;
    background: #75d561;
    display: flex;
    justify-content: space-around;
    ::v-deep .el-input.is-disabled .el-input__inner {
      background: #75d561;
      font-weight: 700;
      color: #ff4800;
      font-size: 18px;
    }
    .customText {
      width: 16.6%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-right: 1px solid #181616;
    }
    .bhxsbg {
      background: #f5f7fa;
      border-bottom: 1px solid #181616;
    }
    .wyLayout {
      font-weight: 700;
    }
    .completeText {
      background: #75d561;
      width: 16.6%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-bottom: 1px solid #181616;
    }
  }
}
</style>